package net.hvacapp.cmvrfforandroid.ui.project.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by zhangnorman on 15/7/29.
 */
public class RoomData implements Parcelable {
    private String guidId;
    private String name;
    private double area;
    private double load;

    private boolean selected;


    public String getGuidId() {
        return guidId;
    }

    public void setGuidId(String guidId) {
        this.guidId = guidId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getArea() {
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public double getLoad() {
        return load;
    }

    public void setLoad(double load) {
        this.load = load;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    /**
     * Describe the kinds of special objects contained in this Parcelable's
     * marshalled representation.
     *
     * @return a bitmask indicating the set of special object types marshalled
     * by the Parcelable.
     */
    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * Flatten this object in to a Parcel.
     *
     * @param dest  The Parcel in which the object should be written.
     * @param flags Additional flags about how the object should be written.
     *              May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}.
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(guidId);
        dest.writeString(name);
        dest.writeDouble(area);
        dest.writeDouble(load);
    }

    /**
     * 序列化实体类
     */
    public static final Creator<RoomData> CREATOR = new Creator<RoomData>() {
        public RoomData createFromParcel(Parcel source) {
            RoomData data = new RoomData();
            data.guidId = source.readString();
            data.name = source.readString();
            data.area = source.readDouble();
            data.load = source.readDouble();

            return data;
        }

        public RoomData[] newArray(int size) {
            return new RoomData[size];
        }
    };

}
